<?
//inculde即可以使用data数据。本页所有的data数据，倾在controller都处理好
include_once("../../../common/modules/checkA.php");
include_once("../../../../config.php");
include_once("../controller/detail-edit.php");
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <link href="../css/<? echo $theme_folder ?>/user.css" rel="stylesheet" type="text/css"/>
    <?php include ROOT_PATH_.'/controller/common/modules/head.php'; ?>
    <?php include 'modules/head.php'; ?>

    <!--kindeditor编辑器-->
 <!--   <link rel="stylesheet" href="../../keditor/themes/default/default.css"/>
    <script charset="utf-8" src="../../keditor/kindeditor-all.js"></script>
    <script charset="utf-8" src="../../keditor/lang/zh_CN.js"></script>

  -->
</head>


<body>

<div id="topbar">
    <?php include ROOT_PATH_.'/controller/common/modules/topbar.php'; ?>
</div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/modules/sidebar.php'; ?>
        </div>






<div id="content" class="layui-form">
	<div class="box member-add-box layui-form detail-box">
<h1>优惠券详情</h1>

        <div class="tips">
            1:激活优惠券，是根据类型去触发激活的。领券中心领取同时已经是激活状态
            <br/>2:用户的优惠券会以用户领取时候状态为准。例：优惠券设置了1000元，客户领取后，管理员再把优惠券设置成10元，客户的优惠券依然是1000元。
        </div>

        <form id="add-employee-form" method="post" action="detail-edit-function.php?nav-itemed=activity" enctype="multipart/form-data" class="layui-form">

<!--    --><?php //include 'mod-images-upload.php'; ?>
    <input type="hidden" name="nid" value="<?php echo $info['nid']?>" />
    <div class="layui-form-item">
        <label class="layui-form-label">优惠券名称</label>
        <div class="layui-input-block">
            <input type="text" name="ai_name" lay-verify="required" placeholder="请输入优惠券名称" autocomplete="off" class="layui-input" value="<?php echo $info['name'];?>">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">优惠类型</label>
        <div class="layui-input-block">
            <input type="radio" name="ai_coupon_type" value="10" title="定额"    <?php echo $info['coupon_type'] == 10  ? 'checked':'';?>>
            <input type="radio" name="ai_coupon_type" value="20" title="分享折扣" <?php echo $info['coupon_type'] == 20  ? 'checked':'';?>>
            <input type="radio" name="ai_coupon_type" value="30" title="邀请折扣" <?php echo $info['coupon_type'] == 30  ? 'checked':'';?>>
            <input type="radio" name="ai_coupon_type" value="40" title="指定金额" <?php echo $info['coupon_type'] == 40  ? 'checked':'';?>>
        </div>
        <div class="notice">分享折扣券：分享首页时候激活；邀请折扣券：邀请好友参与时候激活</div>
    </div>


    <div class="layui-form-item coupon1"  <?php echo $info['coupon_type'] == 10  ? 'style="display:block;"':'style="display:none;"';?>>
        <label class="layui-form-label">优惠价格</label>
        <div class="layui-input-block">
            <input type="text" name="ai_reduce_price"  placeholder="请输入优惠价格" autocomplete="off" class="layui-input" value="<?php echo $info['reduce_price'];?>">
            <div class="notice">优惠多少元，就填写多少。例:减小9元，就填写9。</div>

        </div>
    </div>
    <div class="layui-form-item coupon2" <?php echo $info['coupon_type'] == 20  ? 'style="display:block;"':'style="display:none;"';?>>
        <label class="layui-form-label">优惠折扣</label>
        <div class="layui-input-block">
            <input type="text" name="ai_discount"  placeholder="请输入优惠折扣0-100" autocomplete="off" class="layui-input" value="<?php echo $info['discount'];?>">
            <div class="notice"> 优惠折扣0-100,  5折请输入50,9折请输入90</div>
        </div>
    </div>

    <div class="layui-form-item coupon4" <?php echo $info['coupon_type'] == 40  ? 'style="display:block;"':'style="display:none;"';?>>
        <label class="layui-form-label">指定金额</label>
        <div class="layui-input-block">
            <input type="text" name="ai_reduce_price"  placeholder="请输入指定金额" autocomplete="off" class="layui-input" value="<?php echo $info['reduce_price'];?>">
            <!--            <div class="notice"> 指定金额,  5折请输入50,9折请输入90</div>-->
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">免单券</label>
        <div class="layui-input-block">
            <input type="radio" name="ai_is_free" value="0" title="否" <?php echo $info['is_free'] == 0  ? 'checked':'';?>>
            <input type="radio" name="ai_is_free" value="1" title="是" <?php echo $info['is_free'] == 1  ? 'checked':'';?>>
        </div>
    </div>


        <div class="layui-form-item">
            <label class="layui-form-label">说明</label>
            <div class="layui-input-block">
                <input type="text" name="ai_remark" lay-verify="required" placeholder="请输入优惠券使用说明" autocomplete="off" class="layui-input" value="<?php echo $info['remark'];?>">
            </div>
        </div>


      <!--  <div class="layui-form-item">
            <label class="layui-form-label">活动开始</label>
            <div class="layui-input-block">
                <input type="text" name="ai_start_time" id="date" autocomplete="off" class="layui-input"
                       value="<?php /*echo $info['start_time'] ==  '' ? '' : date("Y-m-d H:i:s",$info['start_time']);*/?>"
                       onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" class="laydate-icon">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">活动结束</label>
            <div class="layui-input-block">

                <input type="text" name="ai_end_time" id="date" autocomplete="off" class="layui-input"
                       value="<?php /*echo $info['end_time'] ==  '0' ? '' : date("Y-m-d H:i:s",$info['end_time']);*/?>"
                       onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                       class="laydate-icon">
            </div>
        </div>-->

            <div class="layui-form-item">
                <label class="layui-form-label">截止日期</label>
                <div class="layui-input-block">

                    <input type="text" name="ai_end_time" id="date" autocomplete="off" class="layui-input"
                           value="<?php echo $info['end_time'];?>"
                           onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                           class="laydate-icon">
                    <div class="notice">填写了截止日期，则以这个为准，【有效天数】将不会生效。</div>
                </div>
            </div>



            <div class="layui-form-item">
                <label class="layui-form-label">优惠券有效天数</label>
                <div class="layui-input-block">
                    <input  class="layui-input" type="input" name="ai_expire_day"   value="<?php echo $info['expire_day'];?>"  >
                    <div class="notice"> 有效天数按照激活优惠券的时间开始计算。例：假设有效天数是7，A在一月一日注册拿到一张5折券，在6月一日再激活，这个有效时间就是6月1日+7天.</div>

                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">适用活动类型</label>
                <div class="layui-input-block">
                    <?php foreach($tag_list as $tag){

                        ?>
                        <input type="checkbox"  <?php echo in_array($tag,$info_tag) == true ?  'checked' : '' ?> name="ai_pinlei[]" value="<?php echo $tag?>" title="<?php echo $tag?>">
                        <?php
                    }
                    ?>

                </div>
            </div>




        <div class="function">
           <div class="layui-input-block">
              <button class="layui-btn" lay-submit lay-filter="formMemberAdd" type="submit">立即提交</button>
              <button type="reset" class="layui-btn layui-btn-primary">重置</button>
           </div>
        </div>



</form>
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>


    <script>
        //Demo
        layui.use('form', function(){
            var form = layui.form;



            form.on('radio()', function(data){
                // console.log(data.elem); //得到radio原始DOM对象
                // console.log(data.value); //被点击的radio的value值
                if(data.value == 10){
                    $('.coupon1').show()
                    $('.coupon2').hide()
                }
                else if(
                         (data.value == 20) || (data.value == 30)
                        )
                {
                    $('.coupon2').show()
                    $('.coupon1').hide()
                }
            });

        });
    </script>


    <?php include ROOT_PATH_ . "/controller/common/modules/footer.php"; ?> </body>
</html>
